{% extends 'layout/basic.html' %}

{% block content %}
    <div class="container">
        <div style="margin-bottom: 10px">
            <a class="btn btn-success" href="/user/model/form/add/">
                <span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span>
                新建用户
            </a>
        </div>

        <div class="panel panel-default">
            <!-- Default panel contents -->
            <div class="panel-heading">
                <span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
                用户列表
            </div>

            <div class="panel-body">
                <p>默认面板文字</p>
            </div>

            <!-- Table -->
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>姓名</th>
                    <th>邮箱</th>
                </tr>
                </thead>
                <tbody>
                {% for obj in queryset %}
                    <tr>
                        <td>{{ obj.id }}</td>
                        <td>{{ obj.username }}</td>
                        <td>{{ obj.email }}</td>
                        <td>
                            <a href="/user/{{ obj.id }}/edit/" class="btn btn-primary btn-xs">编辑</a>
                            <a href="/user/delete/?nid={{ obj.id }}" class="btn btn-danger btn-xs">删除</a>
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>
        {{ page_html|safe }}
        {#            <nav aria-label="...">#}
        {#            <ul class="pagination">#}
        {#                <li>#}
        {#                    <a href="?page=1&q={{ q }}" aria-label="Next">#}
        {#                        <span aria-hidden="true">首页</span>#}
        {#                    </a>#}
        {#                </li>#}
        {#                {% if page > 1 %}#}
        {#                    <li>#}
        {#                        <a href="?page={{ page|add:-1 }}&q={{ q }}" aria-label="Next">#}
        {#                            <span aria-hidden="true">&laquo;</span>#}
        {#                        </a>#}
        {#                    </li>#}
        {#                {% else %}#}
        {#                    <li class="disabled">#}
        {#                        <a href="#" aria-label="Next">#}
        {#                            <span aria-hidden="true">&laquo;</span>#}
        {#                        </a>#}
        {#                    </li>#}
        {#                {% endif %}         <!-- 上一页 -->#}
        {##}
        {##}
        {#                {% if page > querynum|add:-4 %}       <!-- 超过最大页数时 -->#}
        {#                    {{ last_page_string }}#}
        {#                {% else %}#}
        {#                    <li class="active"><a href="?page={{ page }}&q={{ q }}">{{ page }}</a></li>#}
        {#                    {{ page_string }}#}
        {#                    <li><a href="#">...</a></li>#}
        {#                    <li><a href="?page={{ querynum }}&q={{ q }}">{{ querynum }}</a></li>#}
        {#                {% endif %}#}
        {##}
        {##}
        {#                {% if page <= querynum %}#}
        {#                    <li>#}
        {#                        <a href="?page={{ page|add:1 }}&q={{ q }}" aria-label="Next">#}
        {#                            <span aria-hidden="true">»</span>#}
        {#                        </a>#}
        {#                    </li>#}
        {#                {% else %}#}
        {#                    <li class="disabled">#}
        {#                        <a href="#" aria-label="Next">#}
        {#                            <span aria-hidden="true">»</span>#}
        {#                        </a>#}
        {#                    </li>#}
        {#                {% endif %} <!-- 下页 -->#}
        {#                <li>#}
        {#                    <a href="?page={{ querynum }}&q={{ q }}" aria-label="Next">#}
        {#                        <span aria-hidden="true">最后一页</span>#}
        {#                    </a>#}
        {##}
        {#                </li>                       <!-- 最后一页 -->#}
        {#                <form method="get">#}
        {#                    <div class="input-group" style="width: 200px">#}
        {#                        <input type="text" name="page" class="form-control" placeholder="页码">#}
        {#                            <span class="input-group-btn">#}
        {#                                <button class="btn btn-default" type="submit">跳转</button>#}
        {#                            </span>#}
        {#                        </input>#}
        {#                    </div>#}
        {#                </form>#}
        {#            </ul>#}
        {##}
        {#        </nav>#}


    </div>
{% endblock %}